Optimal. Leaf size=81 \[ \frac {a^2 B \log (a \cos (c+d x)+b \sin (c+d x))}{b d \left (a^2+b^2\right )}+\frac {a^3 B x}{b^2 \left (a^2+b^2\right )}-\frac {a B x}{b^2}-\frac {B \log (\cos (c+d x))}{b d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.12, antiderivative size = 81, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.147, Rules used = {21, 3541, 3475, 3484, 3530} \[ \frac {a^2 B \log (a \cos (c+d x)+b \sin (c+d x))}{b d \left (a^2+b^2\right )}+\frac {a^3 B x}{b^2 \left (a^2+b^2\right )}-\frac {a B x}{b^2}-\frac {B \log (\cos (c+d x))}{b d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 21
Rule 3475
Rule 3484
Rule 3530
Rule 3541
Rubi steps
\begin {align*} \int \frac {\tan ^2(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx &=B \int \frac {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx\\ &=-\frac {a B x}{b^2}+\frac {\left (a^2 B\right ) \int \frac {1}{a+b \tan (c+d x)} \, dx}{b^2}+\frac {B \int \tan (c+d x) \, dx}{b}\\ &=-\frac {a B x}{b^2}+\frac {a^3 B x}{b^2 \left (a^2+b^2\right )}-\frac {B \log (\cos (c+d x))}{b d}+\frac {\left (a^2 B\right ) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{b \left (a^2+b^2\right )}\\ &=-\frac {a B x}{b^2}+\frac {a^3 B x}{b^2 \left (a^2+b^2\right )}-\frac {B \log (\cos (c+d x))}{b d}+\frac {a^2 B \log (a \cos (c+d x)+b \sin (c+d x))}{b \left (a^2+b^2\right ) d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 0.10, size = 79, normalized size = 0.98 \[ \frac {B \left (2 a^2 \log (a+b \tan (c+d x))+b (b+i a) \log (-\tan (c+d x)+i)+b (b-i a) \log (\tan (c+d x)+i)\right )}{2 b d \left (a^2+b^2\right )} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.80, size = 95, normalized size = 1.17 \[ -\frac {2 \, B a b d x - B a^{2} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) + {\left (B a^{2} + B b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, {\left (a^{2} b + b^{3}\right )} d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.58, size = 76, normalized size = 0.94 \[ \frac {\frac {2 \, B a^{2} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{2} b + b^{3}} - \frac {2 \, {\left (d x + c\right )} B a}{a^{2} + b^{2}} + \frac {B b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.27, size = 83, normalized size = 1.02 \[ \frac {a^{2} \ln \left (a +b \tan \left (d x +c \right )\right ) B}{d \left (a^{2}+b^{2}\right ) b}+\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) B b}{2 d \left (a^{2}+b^{2}\right )}-\frac {B \arctan \left (\tan \left (d x +c \right )\right ) a}{d \left (a^{2}+b^{2}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.64, size = 75, normalized size = 0.93 \[ \frac {\frac {2 \, B a^{2} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{2} b + b^{3}} - \frac {2 \, {\left (d x + c\right )} B a}{a^{2} + b^{2}} + \frac {B b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.41, size = 81, normalized size = 1.00 \[ \frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,d\,\left (b+a\,1{}\mathrm {i}\right )}+\frac {B\,a^2\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{b\,d\,\left (a^2+b^2\right )}+\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (a+b\,1{}\mathrm {i}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 1.60, size = 447, normalized size = 5.52 \[ \begin {cases} \tilde {\infty } B x \tan {\relax (c )} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {B d x \tan {\left (c + d x \right )}}{- 2 i b d \tan {\left (c + d x \right )} - 2 b d} - \frac {i B d x}{- 2 i b d \tan {\left (c + d x \right )} - 2 b d} - \frac {i B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{- 2 i b d \tan {\left (c + d x \right )} - 2 b d} - \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{- 2 i b d \tan {\left (c + d x \right )} - 2 b d} - \frac {B}{- 2 i b d \tan {\left (c + d x \right )} - 2 b d} & \text {for}\: a = - i b \\\frac {B d x \tan {\left (c + d x \right )}}{2 i b d \tan {\left (c + d x \right )} - 2 b d} + \frac {i B d x}{2 i b d \tan {\left (c + d x \right )} - 2 b d} + \frac {i B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 i b d \tan {\left (c + d x \right )} - 2 b d} - \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 i b d \tan {\left (c + d x \right )} - 2 b d} - \frac {B}{2 i b d \tan {\left (c + d x \right )} - 2 b d} & \text {for}\: a = i b \\\frac {B \left (- x + \frac {\tan {\left (c + d x \right )}}{d}\right )}{a} & \text {for}\: b = 0 \\\frac {x \left (B a + B b \tan {\relax (c )}\right ) \tan ^{2}{\relax (c )}}{\left (a + b \tan {\relax (c )}\right )^{2}} & \text {for}\: d = 0 \\\frac {2 B a^{2} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{2} b d + 2 b^{3} d} - \frac {2 B a b d x}{2 a^{2} b d + 2 b^{3} d} + \frac {B b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} b d + 2 b^{3} d} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________